package services.mes

import com.typesafe.config.Config
import play.api.ConfigLoader

case class MoreMesConfig(serverUrl: String, dCID: String)

protected object MoreMesConfig {
  implicit val configLoader: ConfigLoader[MoreMesConfig] = new ConfigLoader[MoreMesConfig] {
    override def load(config: Config, path: String): MoreMesConfig = {
      val conf = if (path.isEmpty) {
        config.getConfig("more.mes.config.default")
      } else {
        config.getConfig("more.mes.config." + path)
      }

      MoreMesConfig(
        serverUrl = conf.getString("url"),
        dCID = conf.getString("dcid")
      )
    }
  }

}
